<?php

namespace app\common\shop;

use think\Db;
use think\Model;
use think\model\concern\SoftDelete;

// 充值记录
class RechargeLogModel extends model {
//    use SoftDelete;//开启了软删除
//    protected  $deleteTime = 'deltime';
    // 完整数据表名
    protected $table = 'recharge_log';

    public $type = [
        '1'=>'支付宝',
        '2'=>'微信',
    ];
    /**
     * [建表]
     * @return
     */
    public static function createTable(){
        return Db::query("Create Table If Not Exists `recharge_log`(
             `id` int(11) NOT NULL AUTO_INCREMENT,
             `uid` int(11) NOT NULL COMMENT '会员id',
             `sn` varchar(255) NOT NULL COMMENT '订单号',
             `number` decimal (22,2) NOT NULL DEFAULT '0' COMMENT '充值数量',
             `status` int(1) NOT NULL DEFAULT '0' COMMENT '状态',
             `paytype` int(1) NOT NULL COMMENT '支付方式',
             `createtime` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '时间',
             PRIMARY KEY (`id`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='收货地址'");
    }

    /**
     * [添加]
     * @return
     */
    public static function add($data){
        $data['createtime'] = time();
        return self::insertGetId($data);
    }



}